package com.en.sharing.floats;

/**
 * 精度丢失
 * 
 * @author 付晓飞
 * @date 2024/3/13 7:33 下午
 */
public class FloatPrecision {

    public static void main(String[] args) {
        float sum = 0.0f;
        for (int i = 0; i < 20000000; i++) {
            float x = 1.0f;
            sum += x;
        }
        // sum is 1.6777216E7
        System.out.println("sum is " + sum);
    }

}
